package cn.qzzg.controller;

import cn.qzzg.common.ResultBean;
import cn.qzzg.pojo.PotTime;
import cn.qzzg.service.PotTimeService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 控制层
 */
@RestController
@RequestMapping("/potTime")
public class PotTimeController {
    @Resource
    PotTimeService potTimeService;

    /**
     * 查询所有
     *
     * @return List<MyObjet>
     */
    @RequestMapping(value = "/queryAll", method = RequestMethod.GET)
    public ResultBean<?> queryAll(PotTime potTime) {
        return ResultBean.success(potTimeService.findAll(potTime));
    }

    /**
     * 创建锅次（复查锅次），如果是复查锅次，则状态为1
     *
     * @param potTime 需要创建的
     * @return true
     */
    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public ResultBean<?> create(@RequestBody PotTime potTime) {
        return ResultBean.success(potTimeService.saveOne(potTime));
    }
}